/* Yet Another Experimental Software Renderer
 *
 * Copyright (c) 2010 Pawel "Hery" Dziepak
 */

#include "geometry_shader.h"

using namespace yaesr;

void geometry_shader_impl::execute(point x, std::vector<point> &points, std::vector<line>&, std::vector<triangle>&) {
	points.push_back(x);
}

void geometry_shader_impl::execute(line x, std::vector<point>&, std::vector<line> &lines, std::vector<triangle>&) {
	lines.push_back(x);
}

void geometry_shader_impl::execute(triangle x, std::vector<point>&, std::vector<line> &lines, std::vector<triangle> &triangles) {
	//triangles.push_back(x);
	line line0;
	line0.vert0 = x.vert0;
	line0.vert1 = x.vert1;
	lines.push_back(line0);

	line line1;
	line1.vert0 = x.vert0;
	line1.vert1 = x.vert2;
	lines.push_back(line1);

	line line2;
	line2.vert0 = x.vert1;
	line2.vert1 = x.vert2;
	lines.push_back(line2);

	x.vert0.position += vec4(0.8, -0.2, 0.0, 0.0);
	x.vert1.position += vec4(0.8, -0.2, 0.0, 0.0);
	x.vert2.position += vec4(0.8, -0.2, 0.0, 0.0);
	triangles.push_back(x);
}
